package cn.zazhi.action;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import cn.zazhi.dao.CategoryDao;
import cn.zazhi.pojo.Category;
import cn.zazhi.service.CategoryService;

import com.opensymphony.xwork2.ActionSupport;

@Component("categoryAction")
public class CategoryAction extends ActionSupport {
	private Category category;
	private CategoryService categoryService;

	public Category getCategory() {
		return category;
	}

	@Resource
	public void setCategory(Category category) {
		this.category = category;
	}

	public CategoryService getCategoryService() {
		return categoryService;
	}

	@Resource(name="categoryService")
	public void setCategoryService(CategoryService categoryService) {
		this.categoryService = categoryService;
	}

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		categoryService.addCategory(category);
		return SUCCESS;
	}
}
